import Vue from 'vue'
import VueRouter from 'vue-router'

Vue.use(VueRouter)
const routes = [
  {
    path:"/",
    name:"Home",
    redirect:"/HomePage"
  },
  // 首页
  {
    path:"/HomePage",
    name:"HomePage",
    component:()=>import("../views/HomePage/index.vue")
  },
  // 分类
  {
    path:"/Classification",
    name:"Classification",
    component:()=>import("../views/Classification/index.vue")
  },
  // 购物车
  {
    path:"/ShoppingCart",
    name:"ShoppingCart",
    component:()=>import("../views/ShoppingCart/index.vue")
  },
  // 个人
  {
    path:"/Personal",
    name:"Personal",
    component:()=>import("../views/Personal/index.vue")
  }
]
// const routes = [{
//     path: '/',
//     name: 'Home',
//     redirect: "/Sign"
//   },
//   // 登录路由
//   {
//     path: "/Sign",
//     name: "sign",
//     component: () => import("../views/Sign.vue")
//   },
//   // 首页
//   {
//     path: "/first",
//     name: "first",
//     component: () => import("../views/first/index.vue"),
//     redirect:"/first/backstage",
//     children: [{
//       path: "backstage",
//       name: "backstage",
//       component: () => import("../views/first/backstage.vue"),
//     },{
//       path:"album",
//       name:"album",
//       component:()=>import("../views/first/album.vue")
//     },{
//       path:"commodity",
//       name:"commodity",
//       component:()=>import("../views/first/commodity.vue")
//     }]
//   },
//   // 商品
//   {
//     path: "/commodity",
//     name: "commodity",
//     redirect:"/commodity/details",
//     component: () => import("../views/commodity/index.vue"),
//     children:[{
//       path: "details",
//       name: "details",
//       component: () => import("../views/commodity/details.vue"),
//     }]
//   },
//   // 订单
//   {
//     path: "/order",
//     name: "order",
//     component: () => import("../views/order/index.vue")
//   },
//   // 会员
//   {
//     path: "/member",
//     name: "member",
//     component: () => import("../views/member/index.vue")
//   }
// ]

const router = new VueRouter({
  routes
})
// router.beforeEach((to, from, next) => {
//   if (localStorage.getItem("token")) {
//     next();
//   } else {
//     if (to.path == "/Sign") {
//       next();
//     } else {
//       next("/Sign")
//     }
//   }
// })
export default router